<?php
/**
 *
 * @copyright   Copyright(c) 2011
 * @author      yuansir <yuansir@live.cn/yuansir-web.com>
 * @version     1.0
 */
class homeController extends Controller {
		public $model = null;
        public function __construct() {
                parent::__construct();
                $this->model = $this->model('home');
        }

        public function index() {
            $spage = intval($this->input->get('p',1));
            $classid = intval($this->input->get('classid'));
			$keyword = htmlspecialchars($this->input->get('keyword'));
			$data = $this->model->showlist($spage,$keyword,$classid);
			$data['className'] = $this->model->showClass();
			$data['keyword'] = $keyword;
			$this->showTemplate('home', $data);
        }


		public function view()
		{
			$id = intval($this->input->get('id'));
			$data = $this->model->showpage($id);
			$this->showTemplate('view', $data);
		}

		public function updateClassNum()
		{
			$data = $this->model->updateClass();
		}

		public function toHtml()
		{
			$data['className'] = $this->model->showClass();
			$this->saveToHtml('index',$data);
		}
}

